#include <iostream>
#include <string>

using namespace std;

bool match(const std::string& pattern, const std::string& s) {
    int pl = pattern.size();
    int sl = s.size();

    int i = 0, j = 0;
    for (i = 0; i < pl; i++) {
        if (pattern[i] == '+') {
            for (; j < sl && s[j] == pattern[i - 1]; j++);
            continue;
        } else {
            if (pattern[i] != s[j])
                return false;
            else
                j++;
        }
    }
    if (j != sl) return false;
    return true;
}

int main() {
    cout << match("ab+cd+e", "abbbcdee") << endl;
}